#ifndef CUDAVEC_H
#define CUDAVEC_H

template <typename T>
class CUDA_vec {
public:

	CUDA_vec();

	CUDA_vec(int s);

	CUDA_vec(const CUDA_vec<T> & b);

	~CUDA_vec();

	void destroy();

	void copyToDevice(T * host_data, int host_size);

	int getSize() const { return size; }

	void extractFromDevice (T * host_data) const;

	void set_constant(T constant);

	T * raw_pointer();

	const T * raw_pointer() const;

	/**
	 * Copies pointer to other array, but not array itself
	 */
	CUDA_vec<T> & operator=(const CUDA_vec<T> & other);

	CUDA_vec<T> & AXPBY(T a, T b, const CUDA_vec<T> & y);

	CUDA_vec<T> & operator*=(const CUDA_vec<T> & other);

	CUDA_vec<T> & reciprocal();

	T dotProd(const CUDA_vec<T> & other) const;

	void copyValues(const CUDA_vec<T> & other);

private:
	void copyNewArray(const T * array, int size);
	void copySameArray(const T * array, int size);
	int size;
	T * data;

};
#endif
